﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NCalculator.Operations
{
    [Serializable()]
    public class SubstractionNode : OperationNode
    {
        public SubstractionNode()
        {
            _priority = 4;
        }

        /// <summary>
        /// Evaluation result of substraction
        /// </summary>
        /// <returns></returns>
        public override double Evaluation()
        {
            return _left.Evaluation() - _right.Evaluation();
        }

        /// <summary>
        /// Convert the result of operation to string 
        /// </summary>
        /// <returns>Returns calculated value as string</returns>
        public override string ToString()
        {
            if ((_left == null) || (_right == null))
                return " - ";
            else
            {
                //return string.Format("{0} - {1} ", _left.Evaluation().ToString(), _right.Evaluation().ToString());
                return " - ";
            }
        }
    }
}
